﻿using System;
using System.Collections.Generic;
using System.Text;
using Webcam_Filter;

namespace Webcam_Filter
{
    public class Cirkelfilter : Filter
    {
        protected override void runfilter(byte[] rgbValues, int hoogte, int breedte, string[] args)
        {
            int AllePixels = (hoogte * breedte * 4);
            int xmidden = breedte / 2;
            int ymidden = hoogte / 2;

            for (int x = 0; x < breedte; x++)
            {
                for (int y = 0; y < hoogte; y++)
                {
                    int i = (y * breedte + x) * 4;
                    double dist = Math.Sqrt(Math.Pow(x - xmidden, 2) + Math.Pow(y - ymidden, 2));
                    double sn = Math.Abs(Math.Cos(dist * 6 * Math.PI / (breedte / 2)));
                    rgbValues[i] = (byte)(dist * sn);
                }
            }
        }

    }
}
